<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Offline extends Controller_Template {

  public $template = 'templates/offline';

  public $auto_render = TRUE;

  public function before() {
    // This codeblock is very useful in development sites:
    // What it does is get rid of invalid sessions which cause exceptions, which may happen
    // 1) when you make errors in your code.
    // 2) when the session expires!
    // Execute parent::before first
    parent::before();

    $this->system_settings = ORM::factory('system_settings')->find(1);
    if ($this->system_settings->online == 1) {
      Request::instance()->redirect('/');
    }

  }


  public function action_index() {

  }

  /**
   * Fill in default values for our properties before rendering the output.
   */
  public function after() {
    // Run anything that needs to run after this.
    parent::after();
  }

}
